<template>
	<div>
		<v-card>
			<v-tabs vertical slider-size="5">
				<v-tab>
					<v-icon left>mdi-account</v-icon>基本信息
				</v-tab>

				<v-tab-item>
					<v-card flat>
						<v-card-text>
							<!-- <v-switch v-model="formState" :label="formState ? '编辑' : '查看'"></v-switch> -->
							<v-form ref="form" v-model="valid" lazy-validation>
								<v-text-field :disabled="formState" dense v-model="userToken.name" outlined label="登录账号"
									required></v-text-field>
								<v-text-field :disabled="formState" dense v-model="userToken.code" outlined label="员工工号"
									required></v-text-field>
								<v-text-field :disabled="formState" dense v-model="userToken.realname" outlined
									label="真实姓名" required></v-text-field>
								<v-text-field :disabled="formState" dense v-model="userToken.email" outlined
									label="电子邮箱" required></v-text-field>
								<v-text-field :disabled="formState" dense v-model="userToken.phonenumber" outlined
									label="联系号码" required></v-text-field>
								<v-text-field :disabled="formState" dense v-model="userToken.roles" outlined
									label="当前账套角色" required></v-text-field>
									<v-text-field :disabled="formState" dense v-model="userToken.department" outlined
										label="当前账套所在部门" required></v-text-field>
										<v-text-field :disabled="formState" dense v-model="userToken.accountBookListToWeb" outlined label="拥有账套"
									required></v-text-field>

							</v-form>
							<!-- <p>拥有账套: {{userToken.accountBookListToWeb}}</p> -->
							<!-- <p>ua: {{uaData.ua}}</p>
              <p>browser(浏览器信息): {{uaData.browser}}</p>
              <p>engine(引擎): {{uaData.engine}}</p>
              <p>os(操作系统): {{uaData.os}}</p>
              <p>cpu: {{uaData.cpu}}</p> -->
						</v-card-text>
					</v-card>
				</v-tab-item>
			</v-tabs>
		</v-card>
	</div>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		computed: {
			...mapState("admin/ua", {
				uaData: "data",
			}),
			...mapState('admin/user', [
				'info'
			])
		},
		data: () => ({
			userToken: {},
			valid: true,
			formState: true,
			rules: {
				nameRules: [
					(v) => !!v || "用户名不能为空",
					(v) => (v && v.length <= 10) || "用户名不能超过10个字符",
				],
			},
		}),
		created() {
			this.getUserInfo()

		},
		methods: {
			async getUserInfo() {
				var response = await this.$httpRequest({
					url: 'Home/GetUserInfo',
					method: 'get'
				});
				if (response.status == 1) {
					this.userToken = response.data
					this.userToken.accountBookListToWeb = this.userToken.accountBookListToWeb.map(r => {
						return r.text
					})
				}
			}

		},
	};
</script>
<style lang="scss">
</style>
